import envConfig from "./env";
import axios from "axios";

const requs = axios.create({
  baseURL: envConfig.perod.baseURL,
  timeout: 5000,
});

requs.interceptors.request.use(
  (config) => {
    config.headers.Authorization = localStorage.getItem("token");
    return config;
  },
  (err) => {
    return Promise.reject(err);
  }
);
requs.interceptors.response.use(
  (res) => {
    return res.data;
  },
  (errs) => {
    return Promise.reject(errs);
  }
);

export default requs;
